package Player;

import javazoom.jl.player.Player;

import java.applet.Applet;
import java.applet.AudioClip;
import java.io.BufferedInputStream;
import java.net.MalformedURLException;
import java.net.URL;

public class MusicPlayer {
    Player player = null;

    public MusicPlayer(String path)  {
        try {
        BufferedInputStream in = new BufferedInputStream(this.getClass().getResource(path).openStream());
        player = new Player(in);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public void play(){
        try {
            player.play();
        }catch (Exception e){
            e.printStackTrace();
        }

    }
    public void stop(){
        player.close();
    }

}
